#include <stdio.h>
char *week_day[8]={"sunday","monday","tuesday","wednesday",
                    "thursday","friday","saturday",NULL};
main()
{	    	  	 
    int l;
    char string[20];
    printf("Enter a string:");
    scanf("%s",string);
    l=lookup(string);
    printf("l=%d\n",l);
}	    	  	 
lookup(ch)
    char ch[];
{	    	  	 
    int i,j;
    char *pc;
    for(i=0;week_day[i]!=NULL;i++)
    {	    	  	 
        for(pc=week_day[i],j=0;*pc==ch[j]&&*pc!='\0';j++,pc++);
        if(*pc=='\0')
            return i;
    }
    return -1;
}	   